package com.black.carbon.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.black.carbon.entity.displaySet;
import com.black.carbon.mapper.DisplayMapper;
import com.black.carbon.service.DisplayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class DisplayServiceImpl implements DisplayService {
    @Autowired
    DisplayMapper displayMapper;
    @Override
    public displaySet selectByTitle(String title) {
        displaySet displayset = displayMapper.selectByTitle(title);
        System.out.println(displayset);
        return displayset;
    }
    public Page<Map<String, Object>> postsListPage(Integer currentPage, Integer size, Integer cid, String orderBy) {
        //currentPage当前页，size每页条数，
        Page<Map<String, Object>> page = new Page<>(currentPage,size);
        QueryWrapper<displaySet> queryWrapper = new QueryWrapper<>();
        Page<Map<String, Object>> list= displayMapper.postsListPage(page, queryWrapper, cid, orderBy);
        return list;
    }

    @Override
    public void save(displaySet displayset) {
        displayMapper.save(displayset);
    }
}
